package com.qf.purchasing.service.Impl;

import com.qf.common.base.exception.ServiceException;
import com.qf.common.base.result.RespResult;
import com.qf.common.base.result.ResultCode;
import com.qf.purchasing.mapper.AgentMapper;
import com.qf.purchasing.service.AgentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AgentServiceImpl implements AgentService {
    @Resource
    private AgentMapper agentMapper;

    @Override
    public RespResult<List<String>> queryName() {
        List<String> allName = agentMapper.selectAllName();
        if (allName.isEmpty()) {
            throw new ServiceException(ResultCode.QUERY_ERROR);
        }
        return RespResult.success(ResultCode.SUCCESS, allName);
    }
}
